home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / GXMath.p < prev    next >
Text File  |  1996-05-01  |  5KB  |  133 lines

  1. {
  2.      File:        GXMath.p
  3.  
  4.      Contains:    QuickDraw GX math routine interfaces.
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT GXMath;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __GXMATH__}
  28. {$SETC __GXMATH__ := 1}
  29.  
  30. {$I+}
  31. {$SETC GXMathIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __FIXMATH__}
  41. {$I FixMath.p}
  42. {$ENDC}
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48.  
  49. TYPE
  50.     gxPointPtr = ^gxPoint;
  51.     gxPoint = RECORD
  52.         x:                        Fixed;
  53.         y:                        Fixed;
  54.     END;
  55.  
  56.     gxColorValue                        = INTEGER;
  57.     gxPolarPtr = ^gxPolar;
  58.     gxPolar = RECORD
  59.         radius:                    Fixed;
  60.         angle:                    Fixed;
  61.     END;
  62.  
  63.     gxMappingPtr = ^gxMapping;
  64.     gxMapping = RECORD
  65.         map:                    ARRAY [0..2,0..2] OF Fixed;
  66.     END;
  67.  
  68.  
  69. CONST
  70.     gxColorValue1                = $0000FFFF;                    {  gxColorValue 1.0  }
  71.  
  72.     gxPositiveInfinity            = $7FFFFFFF;                    {  for Fixed and Fract  }
  73.     gxNegativeInfinity            = $80000000;                    {  for Fixed and Fract  }
  74.  
  75. {$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
  76. FUNCTION CopyToMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  77. FUNCTION InvertMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  78. FUNCTION MapMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  79. FUNCTION MoveMapping(VAR target: gxMapping; hOffset: Fixed; vOffset: Fixed): gxMappingPtr; C;
  80. FUNCTION MoveMappingTo(VAR target: gxMapping; hPosition: Fixed; vPosition: Fixed): gxMappingPtr; C;
  81. FUNCTION NormalizeMapping(VAR target: gxMapping): gxMappingPtr; C;
  82. FUNCTION RotateMapping(VAR target: gxMapping; angle: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  83. FUNCTION ScaleMapping(VAR target: gxMapping; hFactor: Fixed; vFactor: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  84. FUNCTION ResetMapping(VAR target: gxMapping): gxMappingPtr; C;
  85. FUNCTION SkewMapping(VAR target: gxMapping; skewX: Fixed; skewY: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  86. PROCEDURE MapPoints({CONST}VAR source: gxMapping; count: LONGINT; VAR vector: gxPoint); C;
  87. FUNCTION FirstBit(x: LONGINT): INTEGER; C;
  88. FUNCTION WideScale({CONST}VAR source: wide): INTEGER; C;
  89. FUNCTION LinearRoot(first: Fixed; last: Fixed; VAR t: Fract): INTEGER; C;
  90. FUNCTION QuadraticRoot(first: Fixed; control: Fixed; last: Fixed; VAR t: Fract): INTEGER; C;
  91. FUNCTION PolarToPoint({CONST}VAR ra: gxPolar; VAR xy: gxPoint): gxPointPtr; C;
  92. FUNCTION PointToPolar({CONST}VAR xy: gxPoint; VAR ra: gxPolar): gxPolarPtr; C;
  93. FUNCTION FractCubeRoot(source: Fract): Fract; C;
  94. FUNCTION FractDivide(dividend: Fract; divisor: Fract): Fract; C;
  95. FUNCTION FractMultiply(multiplicand: Fract; multiplier: Fract): Fract; C;
  96. FUNCTION FractSineCosine(degrees: Fixed; VAR cosine: Fract): Fract; C;
  97. FUNCTION FractSquareRoot(source: Fract): Fract; C;
  98. FUNCTION FixedDivide(dividend: Fixed; divisor: Fixed): Fixed; C;
  99. FUNCTION FixedMultiply(multiplicand: Fixed; multiplier: Fixed): Fixed; C;
  100. {  This next call is (source * multiplier / divisor) -- it avoids underflow, overflow by using wides  }
  101. FUNCTION MultiplyDivide(source: LONGINT; multiplier: LONGINT; divisor: LONGINT): LONGINT; C;
  102. FUNCTION Magnitude(deltaX: LONGINT; deltaY: LONGINT): LONGINT; C;
  103. FUNCTION VectorMultiplyDivide(count: LONGINT; {CONST}VAR vector1: LONGINT; step1: LONGINT; {CONST}VAR vector2: LONGINT; step2: LONGINT; divisor: LONGINT): LONGINT; C;
  104. {  wide operations are defined within FixMath.h only for PowerPC  }
  105. {$IFC NOT GENERATINGPOWERPC }
  106. FUNCTION WideAdd(VAR target: wide; {CONST}VAR source: wide): widePtr; C;
  107. FUNCTION WideCompare({CONST}VAR target: wide; {CONST}VAR source: wide): INTEGER; C;
  108. FUNCTION WideNegate(VAR target: wide): widePtr; C;
  109. FUNCTION WideShift(VAR target: wide; shift: LONGINT): widePtr; C;
  110. FUNCTION WideSquareRoot({CONST}VAR source: wide): LONGINT; C;
  111. FUNCTION WideSubtract(VAR target: wide; {CONST}VAR source: wide): widePtr; C;
  112. FUNCTION WideMultiply(multiplicand: LONGINT; multiplier: LONGINT; VAR target: wide): widePtr; C;
  113. {  returns the quotient  }
  114. FUNCTION WideDivide({CONST}VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): LONGINT; C;
  115. {  quotient replaces dividend  }
  116. FUNCTION WideWideDivide(VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): widePtr; C;
  117. {$ENDC}
  118. FUNCTION VectorMultiply(count: LONGINT; {CONST}VAR vector1: LONGINT; step1: LONGINT; {CONST}VAR vector2: LONGINT; step2: LONGINT; VAR dot: wide): widePtr; C;
  119. FUNCTION RandomBits(count: LONGINT; focus: LONGINT): LONGINT; C;
  120. PROCEDURE SetRandomSeed({CONST}VAR seed: wide); C;
  121. FUNCTION GetRandomSeed(VAR seed: wide): widePtr; C;
  122. {$ENDC}
  123. {$ALIGN RESET}
  124. {$POP}
  125.  
  126. {$SETC UsingIncludes := GXMathIncludes}
  127.  
  128. {$ENDC} {__GXMATH__}
  129.  
  130. {$IFC NOT UsingIncludes}
  131.  END.
  132. {$ENDC}
  133.